package org.pubflex{
    import component.*;
    
    public class ModelUtility{
        namespace XML_NS = "http://www.w3.org/XML/1998/namespace";
        namespace ATOM = "http://www.w3.org/2005/Atom"
        namespace APP = "http://www.w3.org/2007/app";
        use namespace APP;
        use namespace ATOM;        
                            
        public static function newEntry(newEntryForm:NewEntryBase):XML{

          var x:XML = <entry xmlns={ATOM} xmlns:app={APP}></entry>;                    
          x.title = newEntryForm.entryTitle.text;
          x.content = newEntryForm.entryContent.text;          

          x.authors.author = "robevans@cisco.com";
          x.APP::updated = new Date();
          trace("ENTRY XML: " + x.toXMLString());
          return x;
        }
        public static function createNewEntry():XML{   
            var newEntry:XML = new XML("<entry/>");                                    
            newEntry.addNamespace(ATOM);
            newEntry.addNamespace(APP);
            
            newEntry.id = "urn:888";             
            newEntry.title = "Some Title"; 
            
            newEntry.author.name = "Rob Evans";
            newEntry.author.email = "objectiveous@gmail.com";

            newEntry.content = "aaa";            
            newEntry.content.@type = "xhtml";
            
            newEntry.APP::edited = new Date();
            return newEntry;
        }
    }
}